<?php
// +----------------------------------------------------------------------
// | [ WE ONLY DO WHAT IS NECESSARY ]
// +----------------------------------------------------------------------
// | Author < 931274989@qq.com >
// +----------------------------------------------------------------------
// | Explain 洗车
// +----------------------------------------------------------------------
namespace app\ymkj\controller;

use app\model\Order as orderModel;
use think\facade\Session;
use think\Controller;
use think\Db;
use pay\Pay;
 
class Buy extends Controller
{
  public function index()
  {
    $pay = new Pay();
    $param = array();
    $order_id = input('order_id');
    $order = Db::name('order')->where('id','=',$order_id)->find();
    if(!$order){
    	$this->error("订单不存在");
    }
    $param['body'] = $order['name'];
    $param['remark'] = $order['name'];
    $param['reqsn'] = $order['id'];
    $param['trxamt'] = $order['jine']*100;
    $returl_url = $pay->Pay_request($param);
    
    $url = "https://syb.allinpay.com/apiweb/h5unionpay/unionorder?".$returl_url;
    Header("Location: $url"); 
    /*
    $this->assign('url',$url);
    $this->assign('order',$order);
    return view();*/
  }
  
  
  

  
}
?>